﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Navigation;
using System.Windows.Shapes;
using TransCode.Logic;
using TransCode.Entitys;

namespace ConfigTools
{
    /// <summary>
    /// Interaction logic for ServerListPage.xaml
    /// </summary>
    public partial class ServerListPage : Page
    {
        public ServerListPage()
        {
            InitializeComponent();
        }

        ServerLogic serverLogic = new ServerLogic();

        private void Page_Loaded(object sender, RoutedEventArgs e)
        {
            DataBind();           
        }

        private void Delete_Click(object sender, RoutedEventArgs e)
        {
            Button btn = sender as Button;
            Server server = btn.Tag as Server;
            serverLogic.Delete(server);
            DataBind();
        }

        void DataBind()
        {
            dataGrid1.ItemsSource = serverLogic.ServerList();
        }

        private void dataGrid1_RowEditEnding(object sender, DataGridRowEditEndingEventArgs e)
        {

        }
    }
}
